<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	contentType="text/html; charset=utf-8"%>
<jsp:directive.page import="com.icss.beans.User" />
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<script Language="JavaScript">
function CheckForm()
{

   if(document.form1.USER_NAME.value=="")
   { alert("姓名不能为空！");
     return (false);
   }
   return (true);
}

function CheckDate(op)
{
   mon=document.form1.BIR_MON.value;
   year=document.form1.BIR_YEAR.value;

   if(mon=="04" || mon=="06" || mon=="09" || mon=="11")
   {
     if(document.form1.BIR_DAY.options.length>30)
         document.form1.BIR_DAY.remove(30);
     else if(document.form1.BIR_DAY.options.length<30)
     {
       if(document.form1.BIR_DAY.options.length==28)
       {
         var my_option = document.createElement("OPTION");
         my_option.text="29";
         my_option.value="29";
         document.form1.BIR_DAY.add(my_option);
       }

       var my_option = document.createElement("OPTION");
       my_option.text="30";
       my_option.value="30";
       document.form1.BIR_DAY.add(my_option);
     }
   }

   else if(mon=="02")
   {
     document.form1.BIR_DAY.remove(30);
     document.form1.BIR_DAY.remove(29);

     if(document.form1.BIR_DAY.options.length>28)
     if (!(year%400==0 || (year%4==0 && year%100!=0)))
       document.form1.BIR_DAY.remove(28);

     if(document.form1.BIR_DAY.options.length<29)
     if ((year%400==0 || (year%4==0 && year%100!=0)))
     {
       var my_option = document.createElement("OPTION");
       my_option.text="29";
       my_option.value="29";
       document.form1.BIR_DAY.add(my_option);
     }
   }
   else
   {
     if(document.form1.BIR_DAY.options.length<31)
     {
       if(document.form1.BIR_DAY.options.length==28)
       {
         var my_option = document.createElement("OPTION");
         my_option.text="29";
         my_option.value="29";
         document.form1.BIR_DAY.add(my_option);
       }

       if(document.form1.BIR_DAY.options.length==29)
       {
         var my_option = document.createElement("OPTION");
         my_option.text="30";
         my_option.value="30";
         document.form1.BIR_DAY.add(my_option);
       }

       var my_option = document.createElement("OPTION");
       my_option.text="31";
       my_option.value="31";
       document.form1.BIR_DAY.add(my_option);
     }
   }

   if(op==1)
      document.form1.USER_NAME.focus();
}

</script>
<LINK href="<%=basePath%>/css/main.css" type="text/css" rel="stylesheet">
<script type="text/javascript"
	src="<%=basePath%>js/My97DatePicker/WdatePicker.js"></script>
<body>
<table border="0" width="90%" cellspacing="0" cellpadding="3"
	class="small">
	<tr>
		<td class="Big"><img
			src="<%=basePath%>/img/user_list/node_user.gif" WIDTH="16"
			HEIGHT="16" align="absmiddle"><span class="big3"> 个人资料</span><br>
		</td>
	</tr>
</table>
<form action="UserManage?action=updateuserinfo" method="post"
	name="form1" onsubmit="return CheckForm();">
<table class="TableBlock" width="450" align="center">

	<tr>
		<td nowrap class="TableHeader" colspan="2"><b>&nbsp;基本信息</b></td>
	</tr>

	<tr>
		<td nowrap class="TableData">姓名：</td>
		<td class="TableData"><input type="text" name="userName"
			size="10" maxlength="10" class="BigStatic"
			value="${UserInfo.userName }" readonly></td>
	</tr>
	<tr>
		<td nowrap class="TableData">性别：</td>
		<td class="TableData">
		<%
		User UserInfo=null;
		UserInfo=(User)request.getAttribute("UserInfo") ;
		String sex = UserInfo.getSex().trim();

		request.setAttribute("a",sex);

      	
      	Integer year=1990;
      	Integer month=3;
      	Integer day = 1;
      	if(UserInfo.getBirthday()==null){
      		year = 1990;
      		month = 3;
      		day = 1;
      	}else{
      		String birthday = UserInfo.getBirthday().toString();
      		String[] arr = birthday.split("-");
      		year = Integer.parseInt(arr[0]);
      		month = Integer.parseInt(arr[1]);
      		day = Integer.parseInt(arr[2]);
      	}
      	
      	request.setAttribute("b",year);
      	request.setAttribute("c",month);
      	request.setAttribute("day",day);
    
%> <select name="sex" class="BigSelect">
			<c:choose>
				<c:when test="${a eq '男'}">
					<option value="男" selected>男</option>
					<option value="女">女</option>
				</c:when>
				<c:otherwise>
					<option value="男">男</option>
					<option value="女" selected>女</option>
				</c:otherwise>
			</c:choose>

		</select></td>
	</tr>
	<tr>
		<td nowrap class="TableData">班级：</td>

		<td class="TableData"><select name="stuCalssId">
			<c:forEach items="${stuClassList}" var="sc">
				<c:choose>
					<c:when test="${UserInfo.stuClassId eq sc.stuClassId}">
						<option value="${sc.stuClassId }" selected>${sc.className
						}</option>
					</c:when>
					<c:otherwise>
						<option value="${sc.stuClassId }">${sc.className }</option>
					</c:otherwise>
				</c:choose>
			</c:forEach>
		</select></td>
	</tr>

	<tr>
		<td nowrap class="TableData">生日：</td>

		<td class="TableData"><!-------------- 年 ------------> <select
			name="BIR_YEAR" class="BigSelect" onchange="CheckDate();">
			<c:forEach begin="1900" var="y" end="2010" step="1">

				<c:choose>
					<c:when test="${b eq y}">
						<option value="${y }" selected>${y }</option>
					</c:when>
					<c:otherwise>
						<option value="${y }">${y }</option>
					</c:otherwise>
				</c:choose>
			</c:forEach>

		</select>年 <!-------------- 月 ------------> <select name="BIR_MON"
			class="BigSelect" onchange="CheckDate();">
			<c:forEach begin="1" var="m" end="12" step="1">
				<c:choose>
					<c:when test="${c eq m}">
						<option value="${m }" selected>${m }</option>
					</c:when>
					<c:otherwise>
						<option value="${m }">${m }</option>
					</c:otherwise>
				</c:choose>
			</c:forEach>
		</select>月 <!-------------- 日 ------------> <select name="BIR_DAY"
			class="BigSelect">
			<c:forEach begin="1" var="d" end="31" step="1">
				<c:choose>
					<c:when test="${day eq d}">
						<option value="${d }" selected>${d }</option>
					</c:when>
					<c:otherwise>
						<option value="${d }">${d }</option>
					</c:otherwise>
				</c:choose>
			</c:forEach>
		</select>日</td>
	</tr>
	<tr>
		<td nowrap class="TableHeader" colspan="2"><b>&nbsp;联系方式</b></td>
	</tr>
	<tr>
		<td nowrap class="TableData">联系电话：</td>
		<td class="TableData"><input type="text" name="phone" size="25"
			maxlength="25" class="BigInput" value="${UserInfo.phone }"></td>
	</tr>

	<tr>
		<td nowrap class="TableData">电子邮件：</td>
		<td class="TableData"><input type="text" name="email" size="25"
			maxlength="50" class="BigInput" value="${UserInfo.email }"></td>
	</tr>

	<tr>
		<td nowrap class="TableData">QQ号码：</td>
		<td class="TableData"><input type="text" name="QQ" size="25"
			maxlength="25" class="BigInput" value="${UserInfo.qq }"></td>
	</tr>
	<tr>
		<td nowrap class="TableData">MSN：</td>
		<td class="TableData"><input type="text" name="MSN" size="25"
			maxlength="50" class="BigInput" value="${UserInfo.msn }"></td>
	</tr>

	<tr>
		<td nowrap class="TableHeader" colspan="2"><b>&nbsp;家庭信息</b></td>
	</tr>

	<tr>
		<td nowrap class="TableData">家庭住址：</td>
		<td class="TableData"><input type="text" name="address" size="40"
			maxlength="100" class="BigInput" value="${UserInfo.phone }">
		</td>
	</tr>

	<tr>
		<td nowrap class="TableData">家庭邮编：</td>
		<td class="TableData"><input type="text" name="post" size="25"
			maxlength="25" class="BigInput" value="${UserInfo.post }"></td>
	</tr>

	<tr>
		<td nowrap class="TableData">家庭电话：</td>
		<td class="TableData"><input type="text" name="homeTel" size="25"
			maxlength="25" class="BigInput" value="${UserInfo.homeTel }">
		</td>
	</tr>

	<tr>
		<td nowrap class="TableHeader" colspan="2"><b>&nbsp;学历信息</b></td>
	</tr>

	<tr>
		<td nowrap class="TableData">毕业时间:</td>
		<td class="TableData"><input type="text" name="eduTime"
			class="Wdate" value="${UserInfo.eduTime }" onclick="WdatePicker()" />
		<!--  <input type="text" name="eduTime" size="25" maxlength="25" class="BigInput" value="${UserInfo.eduTime }"> -->
		</td>
	</tr>

	<tr>
		<td nowrap class="TableData">毕业院校:</td>
		<td class="TableData"><input type="text" name="eduSchool"
			size="25" maxlength="25" class="BigInput"
			value="${UserInfo.eduSchool }"></td>
	</tr>

	<tr>
		<td nowrap class="TableData">学业水平:</td>
		<td class="TableData"><input type="text" name="schoolType"
			size="25" maxlength="25" class="BigInput"
			value="${UserInfo.schoolType }"></td>
	</tr>

	<tr>
		<td nowrap class="TableHeader" colspan="2"><b>&nbsp;其它</b></td>
	</tr>

	<tr>
		<td nowrap class="TableData">注册时间:</td>
		<td class="TableData"><input type="text" name="RegisterTime"
			size="25" maxlength="25" class="BigInput"
			value="${UserInfo.registerTime }" readonly></td>
	</tr>
	<tr>
		<td nowrap class="TableData">备注:</td>
		<td class="TableData"><textarea name="remark" rows="5" cols="45">${UserInfo.remark }</textarea>
		</td>
	</tr>

	<tr align="center" class="TableControl">
		<td colspan="2" nowrap><input type="submit" value="保存修改"
			class="BigButton"></td>
	</tr>
</table>
</form>
</body>
</html>
